define(["jquery","template",
    "scprit/nutrition/app/courseLibrary/courseLibrary.servers.js",
	"scprit/nutrition/template/courseLibrary/courseLibrary.tpl.js"],
	function ($,template,$servers,tpl) {
    var ui = {};

    var drawCourseLibirayList = function(data){
    	return template("nutrition_courseLibrary_List",data);
    }
    var drawAddCourseLibirayForm = function(data){
    	return template("nutrition_courseLibrary_addForm",data);
    }

    ui.courseLibirayListInit = function(options){
        $("#" + options.id).html(tpl.courseLibirayList());
        var html = drawCourseLibirayList($servers.handleCourseLibirayList(options.list));
        $("#" + options.id).html(html);
    };
    ui.addCourseLibirayFormInit = function(options){
        var data = {}
        if(options.data) data = $.extend(data,options.data);
    	options.dom.html(tpl.addCourseLibirayForm());
        var html = drawAddCourseLibirayForm(data);
        options.dom.html(html);
    }

    return ui;
});